#include "SavingsAccount.h"

SavingsAccount::SavingsAccount (double initialBalance, double rate)
:Account (initialBalance)
{
   interestRate = 0.0;

   if ( rate > 0.0 )
      interestRate = rate;

   if ( rate < 0.0 )
      cout << "Error: Initial rate cannot be negative.\n" << endl;
   
}

double SavingsAccount::calculateInterest () const
{
    return getBalance () * interestRate;
}
